package com.property.biz.Impl;

import java.util.List;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

import com.property.biz.CommunityBiz;
import com.property.biz.UserBiz;
import com.property.dao.ManagementDao;
import com.property.dao.OwnerDao;
import com.property.dao.UserDao;
import com.property.entity.Management;
import com.property.entity.Owner;
import com.property.entity.Role;
import com.property.entity.User;

@Service("userBiz")
@Scope("prototype")
public class UserBizImpl implements UserBiz{

	@Autowired
	private UserDao userDao;
	@Autowired
	private OwnerDao ownerDao;
	@Autowired
	private ManagementDao managementDao;
	
	public User loginUser(String userName, String passWord) {
		
		return userDao.loginUser(userName, passWord);
	}

	public List<User> getAll() {
		
		return userDao.getAll();
	}

	public void addOwnerUser(User user,Owner owner) {
	  userDao.addUser(user);	
	  ownerDao.addOwner(owner);
	}

	public int checkUsername(String userName) {
		return userDao.checkUsername(userName);
	}
	
	public int getLoginCount(String time) {
		return userDao.getLoginCount(time);
	}

	public void upLoginTime(int id,String time) {
		userDao.upLoginTime(id,time);
	}

	public void updateUser(User user) {
	  userDao.updateUser(user);	
	}

	public void addUser(User user) {
		userDao.addUser(user);
	}

	public void addManageUser(User user, Management management) {
		 userDao.addUser(user);	
		 managementDao.addManage(management);
	}

	public User idUser(String userName) {
	
		return userDao.idUser(userName);
	}

	public void delUserManage(int uid) {
		userDao.delUserManage(uid);
	}
	
}
